import { Menu } from "electron";
import { createAboutWindow } from "./window.js";
import { openDevTools, openAboutWindow } from "./ipcmain-handler/index";

export default (win) => {
  // 创建菜单模板
  const menuTemplate = [
    {
      label: "工具",
      submenu: [
        {
          label: "开发者模式",
          click: openDevTools,
        },
      ],
    },
    {
      label: "关于",
      click: openAboutWindow // 也可以用dialog.showMessageBox 就是有点丑 且不能自定义样式 和 不同平台表现不一致的问题
    },
  ];

  const menuBuilder = Menu.buildFromTemplate(menuTemplate);
  // return menuBuilder;
  Menu.setApplicationMenu(menuBuilder);
};
